import org.junit.*;

import static org.junit.Assert.assertEquals;

public class tritypTest {
    trityp tri=new trityp();

    //    Triang = 1 if triangle is scalene
    //    Triang = 2 if triangle is isosceles
    //    Triang = 3 if triangle is equilaterala
    //    Triang = 4 if not a triangle

    @Test
    public void triang() {
        //我的测试主要针对trityp.Java中的第68行代码
        //condition coverage
        //T F F
        assertEquals(4,tri.Triang(3,2,6));
        //F T F
        assertEquals(4,tri.Triang(6,2,3));
        //F F T
        assertEquals(4,tri.Triang(2,6,3));
        //这样上面三个测试足以让每个条件都有T或F

        //decision coverage
        //表达式为真
        assertEquals(4,tri.Triang(3,2,6));
        //表达式为假
        assertEquals(1,tri.Triang(3,4,5));

        //  MC/DC coverage
        //T F F
        assertEquals(4,tri.Triang(3,2,6));
        //F T F
        assertEquals(4,tri.Triang(6,2,3));
        //F F T
        assertEquals(4,tri.Triang(2,6,3));

        //F F F
        assertEquals(1,tri.Triang(3,4,5));

    }
}